]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Overwrite ongoing animations when calling close repeatedly
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 19 Oct 2012 21:13:16 +0000 (23:13 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 23 Oct 2012 20:21:45 +0000 (22:21 +0200)
Currently close() is a no-op when the menu has already been closed.
However, repeated calls could pass different animation parameters.
For instance in the user menu, we try to hide the menu immediately
before locking the screen, to avoid the popup jumping across the
screen while fading out - as we do this from the corresponding
item's activate handler, the closing is still animated if the menu's
own handler (which requests a full animation) is run first.
Fix this by changing close() to overwrite ongoing animations before
bailing out early.

https://bugzilla.gnome.org/show_bug.cgi?id=686484

js/ui/boxpointer.js
js/ui/popupMenu.js

index 543500201c5398cf6801aaf62a139a23d284fede..01bc2c8d8ed0ae7d33f0b6c0aec5d5bb773ca692 100644 (file)
@@ -141,6 +141,7 @@ const BoxPointer = new Lang.Class({
 
         this._muteInput();
 
+        Tweener.removeTweens(this);
         Tweener.addTween(this, { opacity: fade ? 0 : 255,
                                  xOffset: xOffset,
                                  yOffset: yOffset,
index 23368a5b6dc80fb8f5161a02b8c42e02326464e8..a469388660df4ef0e6ef56484e799e56b5962851 100644 (file)
@@ -1269,13 +1269,14 @@ const PopupMenu = new Lang.Class({
     },
 
     close: function(animate) {
-        if (!this.isOpen)
-            return;
-
         if (this._activeMenuItem)
             this._activeMenuItem.setActive(false);
 
-        this._boxPointer.hide(animate);
+        if (this._boxPointer.actor.visible)
+            this._boxPointer.hide(animate);
+
+        if (!this.isOpen)
+            return;
 
         this.isOpen = false;
         this.emit('open-state-changed', false);